SRC_DIR= ..
DIST_NAME=textplugin
UTILS= ${SRC_DIR}/Utils
TEXT_PLUGIN= ${SRC_DIR}/TextPlugin

OBJS= ${TEXT_PLUGIN}/TextReader.o ${TEXT_PLUGIN}/PageManager.o \
	${TEXT_PLUGIN}/LuaParser.o ${TEXT_PLUGIN}/StreamManager.o \
	${UTILS}/Fonts/FontManager.o ${UTILS}/DebugStream.o \
	TextPlugin.o

TARGET=i386

SDK_INC=../../v3sdk-1.2.1/include
SDK_LIBS=../../v3sdk-1.2.1/${TARGET}/lib

hosttype=i386
STRIP= strip

EXEC= libhltxt.so
CONFIG_FILES= textplugin.lua

LUALIBS = -L/usr/local/lib -llua
LUAINC = /usr/local/include

CFLAGS=  -W -Wall -g2 -I../ -I./ -I${SDK_INC}

CXXFLAGS= -W -Wall -g2 -I../include -I../ -I${SDK_INC} -I${LUAINC}

TXTLIBS= $(LIBS) -L/root/$(hosttype)-libs  -lfreetype -lm  \
                    -ldl

LDFRAGS = ${LUALIBS} -L${SDK_LIBS} ${TXTLIBS}

.PHONY: all
.PHONY: dist

all:$(EXEC)

$(EXEC):$(OBJS)
	$(CXX) $(CXXFLAGS) -shared -o $(EXEC) $(OBJS) ${LDFRAGS}

strip: all
	$(STRIP) $(EXEC)

install: all
	cp $(EXEC) ${SDK_LIBS}/

clean:
	rm -rf $(OBJS) $(EXEC)

dist: strip
	tar cfz ${DIST_NAME}.${TARGET}.tgz ${EXEC} ${CONFIG_FILES}
